<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>

	<style type="text/css">
.ui-layout-north {
	z-index: 20 !important;
	overflow: visible !important;;
}

.ui-layout-north .ui-layout-unit-content {
	overflow: visible !important;
}

.ui-widget {
	font-size: 10px !important;
}

.size {
	width: 700px;
	position: relative;
	left: 25%;
	top: 10%;
}

.centro {
	top: 50%
}

.tabela {
	width: 750px;
}
</style>


	<title>Cadastro de Recomendação</title>
</h:head>

<h:body>
	<ui:decorate template="/templateBase.xhtml">

		<ui:define name="center">

			<h:form prependId="true" id="formCadastroRecomendacao">
				<br />
				<br />
				<p:hotkey bind="f4" update=":formPesquisaAmostra:tabAmostra"
					oncomplete="dlgPesquisaAm.show()" immediate="true" />

				<p:panel header="Cadastro de Recomendação" styleClass="size"
					toggleable="true"
					footer="SIGLAS - Sistema de Gerenciamento de Laboratório de Análise de Solo">
					<p:growl id="growl" life="3000" />
					<br />

					<p:tabView>
						<p:tab title="Principal">
							<br />
							<h:panelGrid columns="3">
								<h:outputText value="Solicitação : " />
								<p:inputText size="6" disabled="true"
									style="background-color:yellow;"
									value="#{recomendacaoBacking.txtCodSolicitacao}" />
								<p:commandButton icon="ui-icon-search"
									oncomplete="dlgPesquisaSol.show()" />
							</h:panelGrid>

							<h:panelGrid columns="2">
								<h:outputText value="Solicitante: " />
								<p:inputText size="40" disabled="true"
									value="#{recomendacaoBacking.txtSolicitante}"
									style="text-transform:uppercase" />
								<h:outputText value="Propriedade: " />
								<p:inputText size="40" disabled="true"
									value="#{recomendacaoBacking.txtPropriedade}"
									style="text-transform:uppercase" />
								<h:outputText value="Data: " />
								<p:calendar size="12" disabled="true"
									value="#{recomendacaoBacking.txtDataSolicitacao}" />

							</h:panelGrid>
						</p:tab>

						<p:tab title="Amostras">
							<br />

							<h:panelGrid columns="1">
								<h:panelGrid columns="9" cellspacing="6">
									<h:panelGrid columns="2">

										<h:outputText value="Amostra:" />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.codAmostraSelecionada}" />
										<h:outputText value="Cultura: " />
										<p:inputText size="20" disabled="true"
											value="#{recomendacaoBacking.txtCultura}" />
										<h:outputText value="Gleba: " />
										<p:inputText size="20" disabled="true"
											value="#{recomendacaoBacking.txtGleba}" />
										<h:outputText value="Profundidade: " />
										<p:inputText size="20" disabled="true"
											value="#{recomendacaoBacking.txtProfundidade}" />

									</h:panelGrid>
									<h:panelGrid columns="8" cellspacing="8">
										<h:outputText value="MO " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtMO}" />
										<h:outputText value="pH " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtPh}" />
										<h:outputText value="S " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtS}" />
										<h:outputText value="P resina " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtP}" />
										<h:outputText value="K " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtK}" />
										<h:outputText value="Ca " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtCa}" />
										<h:outputText value="Mg " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtMg}" />
										<h:outputText value="H+AL " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtHal}" />
										<h:outputText value="Al³+ " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtAl}" />
										<h:outputText value="S.B " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtSb}" />
										<h:outputText value="CTC pH7 " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtCtc}" />
										<h:outputText value="V% " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtVPorcento}" />
										<h:outputText value="Sat. Al " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtSatAl}" />
										<h:outputText value="Sat. Ca " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtSatCa}" />
										<h:outputText value="Sat. Mg " />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtSatMg}" />
										<h:outputText value="Sat. K" />
										<p:inputText size="5" disabled="true"
											value="#{recomendacaoBacking.txtSatK}" />
									</h:panelGrid>
								</h:panelGrid>
							</h:panelGrid>

							<br />
							<p:separator />
							<br />
							<p:tabView>
								<p:tab title="Calagem">
									<h:outputText value="Digite a recomendação para Calagem:" />
									<br />
									<br />
									<div align="center">
										<p:inputTextarea maxlength="1500" rows="5" tabindex="20"
											cols="50" autoResize="false"
											value="#{recomendacaoBacking.recSalvar.calagem}" />
									</div>
								</p:tab>
								<p:tab title="Adubação Mineral de Plantio">
									<h:outputText
										value="Digite a recomendação para Adubação Mineral de Plantio:" />
									<br />
									<br />
									<div align="center">
										<p:inputTextarea maxlength="1500" rows="5" tabindex="20"
											cols="50" autoResize="false"
											value="#{recomendacaoBacking.recSalvar.adubaMPlantio}" />
									</div>
								</p:tab>

								<p:tab title="Adubação Mineral de Cobertura">
									<h:outputText
										value="Digite a recomendação para Adubação Mineral de Cobertura:" />
									<br />
									<br />
									<div align="center">
										<p:inputTextarea maxlength="1500" rows="5" tabindex="20"
											cols="50" autoResize="false"
											value="#{recomendacaoBacking.recSalvar.adubaMCObertura}" />
									</div>
								</p:tab>

								<p:tab title="Observação">
									<h:outputText value="Digite a observação:" />
									<br />
									<br />
									<div align="center">
										<p:inputTextarea maxlength="1500" rows="5" tabindex="20"
											cols="50" autoResize="false"
											value="#{recomendacaoBacking.recSalvar.obs}" />
									</div>
								</p:tab>
							</p:tabView>

							<br />

							<div align="center">
								<h:panelGrid columns="3">
									<p:commandButton value="Salvar"
										actionListener="#{recomendacaoBacking.salvar}" ajax="false"
										update="growl" />
									<p:commandButton value="Imprimir" icon="ui-icon-print"
										title="Imprimir" ajax="false"
										action="#{recomendacaoBacking.relatorioRecomendacao}"
										update="growl" onclick="this.form.target='_blank'" />
									<p:commandButton value="Cancelar" />
								</h:panelGrid>
							</div>

						</p:tab>

					</p:tabView>
				</p:panel>
			</h:form>


			<h:form id="formPesquisaSolicitacao">
				<p:dialog id="pesqSol" widgetVar="dlgPesquisaSol" width="500"
					height="400" closable="true" hideEffect="clip" modal="true"
					resizable="false" showEffect="clip" appendToBody="true"
					footer="SIGLAS - Sistema de Gerenciamento de Laboratório de Análise de Solos"
					header="Pesquisa de Solicitação">
					<br />
					<br />
					<p:dataTable value="#{recomendacaoBacking.listaSolicitacaoFnl}"
						var="s"
						emptyMessage="Não foi encontrada nenhuma análise finalizada para recomendação.">

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="ID" />
								</f:facet>
								<h:outputText value="#{s.idSolicitacao}" />
							</div>
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Data Solicitação" />
								</f:facet>
								<h:outputText value="#{s.dataEntrada}">
									<f:convertDateTime pattern="dd/MM/yyyy" />
								</h:outputText>
							</div>
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Data de Saída" />
								</f:facet>
								<h:outputText value="#{s.dataSaida}">
									<f:convertDateTime pattern="dd/MM/yyyy" />
								</h:outputText>
							</div>
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Solicitante" />
								</f:facet>
								<h:outputText value="#{s.nome}" />
							</div>
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Ações" />
								</f:facet>

								<p:commandButton value="Selecionar"
									actionListener="#{recomendacaoBacking.selecionaSolicitacao(s)}"
									process="@this" update=":formCadastroRecomendacao"
									onclick="dlgPesquisaSol.hide()" />
							</div>
						</p:column>


					</p:dataTable>

				</p:dialog>

			</h:form>


			<h:form id="formPesquisaAmostra">
				<p:dialog id="pesqSol" widgetVar="dlgPesquisaAm" width="500"
					height="400" closable="true" hideEffect="clip" modal="true"
					resizable="false" showEffect="clip" appendToBody="true"
					footer="SIGLAS - Sistema de Gerenciamento de Laboratório de Análise de Solos"
					header="Pesquisa de Amostra">
					<br />
					<br />
					<p:dataTable value="#{recomendacaoBacking.listaAmostra}" var="am"
						id="tabAmostra"
						emptyMessage="Não foi encontrada nenhuma análise finalizada para recomendação.">

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="ID" />
								</f:facet>
								<h:outputText value="#{am.codAmostra}" />
							</div>
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Cultura" />
								</f:facet>
								<h:outputText value="#{am.cultura}" />
							</div>
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Profundidade" />
								</f:facet>
								<h:outputText value="#{am.profundidade}" />
							</div>
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Gleba" />
								</f:facet>
								<h:outputText value="#{am.gleba}" />
							</div>
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Ações" />
								</f:facet>

								<p:commandButton value="Selecionar"
									actionListener="#{recomendacaoBacking.selecionaAmostra(am)}"
									process="@this" update=":formCadastroRecomendacao"
									onclick="dlgPesquisaAm.hide()" />
							</div>
						</p:column>




					</p:dataTable>

				</p:dialog>

			</h:form>
		</ui:define>
	</ui:decorate>
</h:body>
</html>